//树状数组
//https://loj.ac/s/2436934

#include <iostream>
#include <vector>
#include <queue>
using namespace std;

#define lowbit(x) (x & -x)

typedef long long LL;
int n, m;
const int N = 1e6 + 10;
LL arr[N];

void add(int p, int x) {
    for (int i = p; i <= n; i += lowbit(i)) {
        arr[i] += x;
    }
}

//返回 1 到 p区间的和
LL query(int p) {
    LL sum = 0;

    for (int i = p; i; i -= lowbit(i)) {
        sum += arr[i];
    }

    return sum;
}

int main() {
    cin >> n >> m;

    for (int i = 1; i <= n; i++) {
        //构建数形数组
        int tmp;
        cin >> tmp;
        add(i, tmp);
    }

    for (int i = 1; i <= m; i++) {
        int op, x, y;
        cin >> op >> x >> y;

        if (op == 1)
            add(x, y);
        else
            cout << query(y) - query(x - 1) << endl;
    }

    return 0;
}